<template>
    <div>
        <h2>修改</h2>
        <InputElement v-model="student.name">姓名</InputElement>
        <InputElement v-model="student.age">年龄</InputElement>
        <RadioElement v-model="student.gender" name="updateGender">性别</RadioElement>
        <input type="button" value="修改" @click="handleClick" />
    </div>
</template>

<script>
import InputElement from "../InputElement.vue";
import RadioElement from "../RadioElement.vue";
export default {
    components: { InputElement, RadioElement },
    props:['student'],
    data() {
        return {
          // name:this.student.name,
          // age:this.student.age,
          // gender:this.student.gender
        };
    },
    computed:{
      name:{
        get(){
          return this.student.name;
        },
        set(name){
          this.$emit('setStudent',{...this.student,name});

        }
      }
    },
    methods: {
        async handleClick() {
          console.log(this.name);
        },
    },
};
</script>

<style>
</style>